import type { RouteRecordRaw } from 'vue-router'

/**
 * projectRouter (静态路由)
 */
export const projectRouter: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'Layout',
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'home',
        meta: {
          title: '首页',
          keepAlive: true,
        },
        component: () => import('@/views/home/index.vue'),
      },
      {
        path: '/2048',
        name: '2048',
        meta: {
          title: '2048',
          keepAlive: true,
        },
        component: () => import('@/views/game2048/index.vue'),
      },
      {
        path: '/ticTacToe',
        name: 'ticTacToe',
        meta: {
          title: 'ticTacToe',
          keepAlive: true,
        },
        component: () => import('@/views/ticTacToe/index.vue'),
      },
      {
        path: '/tetris',
        name: 'tetris',
        meta: {
          title: 'tetris',
          keepAlive: true,
        },
        component: () => import('@/views/tetris/index.vue'),
      },
      {
        path: '/snake',
        name: 'snake',
        meta: {
          title: 'snake',
          keepAlive: true,
        },
        component: () => import('@/views/snake/index.vue'),
      },
    ],
  },
]

/**
 * systemRoutes (错误页面路由)
 */
export const systemRoutes = [
  {
    path: '/403',
    name: '403',
    component: () => import('@/components/ErrorPage/403.vue'),
    meta: {
      title: '403页面',
    },
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/components/ErrorPage/404.vue'),
    meta: {
      title: '404页面',
    },
  },
  {
    path: '/500',
    name: '500',
    component: () => import('@/components/ErrorPage/500.vue'),
    meta: {
      title: '500页面',
    },
  },
  // Resolve refresh page, route warnings
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/components/ErrorPage/404.vue'),
  },
]
